use AppleScript version "2.4" -- Yosemite (10.10) or lateruse scripting additionsuse AppleScript version "2.4" -- Yosemite (10.10) or lateruse scripting additions-- 系统偏好面板-通用tell application "System Preferences"	activate	set current pane to pane "com.apple.preference.general"end tell-- 延迟执行下一条命令，if not delay, the window animation will let click action to faildelay 0.3-- 点击"自动隐藏和显示菜单栏"tell application "System Events"	tell application process "System Preferences"		tell window "通用"			click checkbox "自动隐藏和显示菜单栏"		end tell	end tellend tell-- 退出系统偏好设置if application "System Preferences" is running then	tell application "System Preferences" to quitend if